import java.util.Scanner;

/**
 * Created by cc
 * Description:
 * User: CZH
 * Date: 2022-09-09
 * Time: 10:11
 */
public class Test01 {

    public static void main(String[] args) {
        int i = 0;
        int num = 10;   //1010
        System.out.println("奇数序列 ");
        for (i = 31; i >= 0; i-=2){
            System.out.print((num >> i) & 1);
        }
        System.out.println();
        System.out.println("偶数序列 ");
        for (i = 30; i >= 0; i-=2){
            System.out.print((num >> i) & 1);
        }
    }


    public static void main11(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double sum = 0.0;
        int num = 0;
        while (scanner.hasNextDouble()) {
            double tmp = scanner.nextDouble();
            sum += tmp;
            num++;
        }
        System.out.println("sum = " + sum);
        System.out.println("avg = " + (sum / num));
        scanner.close();
    }

    //找到 100-200 中所有 3 的倍数.
    public static void main10(String[] args) {
        int num = 100;
        while (num <= 200){
            if (num % 3 != 0){
                num++;
                continue;
            }
            System.out.println(num);
            num++;
        }
    }

    //找到 100-200 中第一个 3 的倍数.
    public static void main9(String[] args) {
        int num = 100;
        while (num <= 200){
            if (num % 3 == 0){
                System.out.println(num);
                break;
            }
            num++;
        }
    }

    //计算 1! + 2! + 3! + 4! + 5!
    public static void main8(String[] args) {
        int i = 1;
        int count = 0;
        //外层循环计算有几个数字
        while(i <= 5){
            int j = 1;
            int ret = 1;
            //内层循环计算每一次阶乘的数据
            while(j <= i){
                ret *= j;
                j++;
            }
            i++;
            count += ret;
        }
        System.out.println(count);
    }

    //计算 5 的阶乘: 1*2*3*4*5
    public static void main7(String[] args) {
        int i = 1;
        int ret = 1;
        while (i <= 5){
            ret *= i;
            i++;
        }
        System.out.println(ret);
    }

    public static void main6(String[] args) {
        double num = 1.0;
//        switch (num){
//            case 1.0:
//                System.out.println("111");
//                break;
//        }
    }

    public static void main5(String[] args) {
        int day = 1;
        switch (day){
            case 1:
                System.out.println("星期一");
            case 2:
                System.out.println("星期二");
                break;
            case 3:
                System.out.println("星期三");
                break;
            case 4:
                System.out.println("星期四");
                break;
            case 5:
                System.out.println("星期五");
                break;
            case 6:
                System.out.println("星期六");
                break;
            case 7:
                System.out.println("星期日");
                break;
            default:
                System.out.println("输入有误");
                break;
        }
    }

    public static void main4(String[] args) {
        int year = 2000;
        if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)) {
            System.out.println("闰年");
        }else {
            System.out.println("不是闰年");
        }
    }

    public static void main3(String[] args) {
        int a = -10;
        System.out.println(a >>> 1);
    }

    public static void main2(String[] args) {
        int a = 10;
        System.out.println(a >> 1);
    }

    public static void main1(String[] args) {
        int a = 10;
        System.out.println(a << 3); //10 * 2^3
    }
}
